<?php

namespace Shared\URLManagement;

/**
 * 
 * @author Jordan Minchev <j.minchev@object.bg>
 * @copyright (c) 2014, ASPECT.BG Ltd.
 */
class Transliterator {

	/**
	 * 
	 * @param string $text
	 * @param string $separator
	 * @return type
	 */
	public static function transliterate($text, $separator = '-') {
		return $text;
	}

    /**
     * 
     * @param string $text
     * @param string $separator
     * @return string
     */
    public static function urlize($text, $separator = '-') {
        $text = strip_tags($text);
        $text = html_entity_decode($text);
        $text = preg_replace(array('/[^a-zа-я0-9]+/iu', '/(' . $separator . ')+/'), $separator, $text);
        $text = rtrim($text, $separator);
        $text = ltrim($text, $separator);
        return mb_strtolower($text, 'utf-8');
    }

}
